<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title>设置</title>
		<link rel="stylesheet" href="../css/mui.css">
		<link rel="stylesheet" href="../css/bootstrap.min.css">
		<script src="../js/mui.js"></script>
		<script src="../js/jquery.min.js"></script>
		<script src="../js/bootstrap.min.js"></script>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">课程信息</h1>
		</header>

		<div class="mui-content">
			<div class="mui-card">
				<div class="mui-card-content">
					<div class="mui-card-content-inner">
						<span style="font-size: 1.5em;" id="courseName">课程名</span>
						<span class="mui-icon mui-icon-spinner mui-spin" style="color:orange; font-size: 1.2em;"></span>
						<br><br><br>
					</div>
				</div>
			</div>

			<form class="mui-input-group">
				<div class="mui-input-row">
					<label>课程ID</label>
					<input type="text" id="course_id" disabled="disabled">
				</div>
				<div class="mui-input-row">
					<label>课程名称</label>
					<input type="text" id="course_name" disabled="disabled">
				</div>
				<div class="mui-input-row">
					<label>授课教师</label>
					<input type="text" id="course_teacher" disabled="disabled">
				</div>
				<div class="mui-input-row">
					<label>上课班级</label>
					<input type="text" id="course_class" disabled="disabled">
				</div>
			</form>
		</div>

		<script>
			//mui初始化
			mui.init({
				swipeBack: true, //启用右滑关闭功能
			});

			var cID;
			mui.plusReady(function() {
				cID = plus.webview.currentWebview().cID;
				init();
			});

			function init() {
				mui.ajax({
					url: 'http://120.27.247.180:8080/School/course/queryCourseByCID',
					type: "post",
					data: {
						"cID": cID
					},
					dataType: "jsonp",
					contentType: "application/x-www-form-urlencoded; charset=utf-8",
					jsonp: "jsoncallback",
					success: function(data) {
						data = JSON.parse(data);
						jQuery("#courseName").text(data.course.cName);
						jQuery("#course_id").val(data.course.cID);
						jQuery("#course_name").val(data.course.cName);
						jQuery("#course_teacher").val(data.name); //老师名字
						jQuery("#course_class").val(data.course.className);
					},
					error: function() {
						mui.toast("服务器异常，请稍后再试");
					}
				});
			}
		</script>
	</body>
</html>
